package com.lq.ecoldchain.ui.mine.certification.addcertification

import android.arch.lifecycle.MutableLiveData
import com.lq.ecoldchain.base.viewmodel.BaseViewModel
import com.lq.ecoldchain.internet.BaseObserver
import com.lq.ecoldchain.util.toast

/*
*2019/1/16 0016  15:26
*function by lq
*/
class AddCertificationViewModel : BaseViewModel() {
    val name by lazy { MutableLiveData<String>() }
    val phone by lazy { MutableLiveData<String>() }

    val imgUrl by lazy { MutableLiveData<String>() }


    fun commit(){
        if(name.value.isNullOrEmpty() || phone.value.isNullOrEmpty()||imgUrl.value.isNullOrEmpty()){
            toast { "请填写完整信息" }
        }else
            BaseNetCore.ApiServiceImpl.addCertification(name.value!!,phone.value!!,imgUrl.value!!).compose(RxTransformer.switchSchedulers()).subscribe(object:BaseObserver<String>(){
                override fun onSuccess(t: String?) {

                }

                override fun onFail(code: String) {

                }
            })

    }
}